]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Set event phase to CAPTURE for swipe gestures starting in the session
authorJonas Dreßler <verdre@v0yd.nl>
Thu, 31 Jul 2025 09:43:57 +0000 (11:43 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 28 Aug 2025 17:14:06 +0000 (19:14 +0200)
When a swipe gesture can get triggered in the session (ie. on top of a
window, not just from the overview or other shell chrome), we want it to
receive events as soon as possible, as otherwise the clients will see
those events.

So use the CAPTURE phase for the overview gesture and the workspace
switching gesture, which makes sure the gesture sees each event before a
window gets to see it.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2853>

js/ui/overview.js
js/ui/swipeTracker.js
js/ui/workspaceAnimation.js

index cb0bf22f364a97719aabd2a38624c3b81381bc54..5dbd181de721245b317d1b4a0f1cd836bb252257 100644 (file)
@@ -231,7 +231,11 @@ export class Overview extends Signals.EventEmitter {
         const swipeTracker = new SwipeTracker.SwipeTracker(global.stage,
             Clutter.Orientation.VERTICAL,
             Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
-            {allowDrag: false, allowScroll: false});
+            {
+                allowDrag: false,
+                allowScroll: false,
+                phase: Clutter.EventPhase.CAPTURE,
+            });
         swipeTracker.orientation = Clutter.Orientation.VERTICAL;
         swipeTracker.connect('begin', this._gestureBegin.bind(this));
         swipeTracker.connect('update', this._gestureUpdate.bind(this));
index 4720ee10f4fee847937a0f518f60eccdd9541435..a911d034afc9d838eb4c2c62efacecf2b79d27db 100644 (file)
@@ -366,8 +366,13 @@ export const SwipeTracker = GObject.registerClass({
     },
 }, class SwipeTracker extends GObject.Object {
     _init(actor, orientation, allowedModes, params) {
+        params = Params.parse(params, {
+            allowDrag: true,
+            allowScroll: true,
+            phase: Clutter.EventPhase.BUBBLE,
+        });
+
         super._init();
-        params = Params.parse(params, {allowDrag: true, allowScroll: true});
 
         this.orientation = orientation;
         this._allowedModes = allowedModes;
@@ -397,7 +402,7 @@ export const SwipeTracker = GObject.registerClass({
                     ? Clutter.PanAxis.X : Clutter.PanAxis.Y,
             ],
             null);
-        actor.add_action_full("SwipeTracker", Clutter.EventPhase.BUBBLE, this._panGesture);
+        actor.add_action_full('SwipeTracker', params.phase, this._panGesture);
 
         this._touchpadGesture = new TouchpadSwipeGesture(allowedModes);
         this._touchpadGesture.connect('begin', this._beginTouchpadGesture.bind(this));
index e318b0e094400f4a03fb2ef436586aee95f6fafb..70e24fb451351b21bfda8b3aa51cee86221103c2 100644 (file)
@@ -329,7 +329,10 @@ export class WorkspaceAnimationController {
         const swipeTracker = new SwipeTracker.SwipeTracker(global.stage,
             Clutter.Orientation.HORIZONTAL,
             Shell.ActionMode.NORMAL,
-            {allowDrag: false});
+            {
+                allowDrag: false,
+                phase: Clutter.EventPhase.CAPTURE,
+            });
         swipeTracker.connect('begin', this._switchWorkspaceBegin.bind(this));
         swipeTracker.connect('update', this._switchWorkspaceUpdate.bind(this));
         swipeTracker.connect('end', this._switchWorkspaceEnd.bind(this));